package com.ruoyi.littleRedBook.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.littleRedBook.domain.pojo.ChatMessage;
import org.apache.ibatis.annotations.Param;
import java.util.List;

public interface ChatMessageMapper extends BaseMapper<ChatMessage> {
    // 标记指定发送者发给指定接收者的消息为已读
    int markReadBySenderAndReceiver(@Param("senderId") Long senderId, @Param("receiverId") Long receiverId);

    // 获取与当前用户有过聊天的所有用户ID
    List<Long> selectContactIds(@Param("userId") Long userId);

    // 获取两个用户之间的最后一条消息
    ChatMessage selectLastMessage(@Param("userId1") Long userId1, @Param("userId2") Long userId2);
}
